
<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="认领表单" bodyClass="white-bg" libs=["bootstrapSelect"]/>
<div class="wrapper wrapper-content ibox-content">
    <@f.form id="task-form-complete" class="form-horizontal">
    <h4 class="form-header h4"><@ctx.i18n text = "基本信息"/></h4>
    <input name="id" value="${entryEntity.id}" type="hidden">
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "检验编号"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input class="form-control" name="testCode" value="${entryEntity.testCode?default('')}" type="text" placeholder="编号自动生成"  readonly >
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "委托编号"/>：</label>
                <div class="col-sm-8">
                    <@f.tableselect checked=false keyId="entrustCode" keyName="entrustCode" url="/pms/entrust/list"
                    name="entrustCode" boxTitle="委托编号"
                    value="${entryEntity.entrustCode?default('')}" labelValue="${entryEntity.entrustCode?default('')}"
                    tableInfo = "[{field:'entrustCode',title:'委托编号'},{field:'projectName',title:'委托项目'},
                    {field:'sampleCode',title:'样品编号'},{field:'entrustTime',title:'委托日期'}]"
                    placeholder="请选择委托编号" />
                    <input  name="sampleCode" type="hidden" >

                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "执行标准"/>：</label>
                <div class="col-sm-8">
                    <@f.tableselect checked=false keyId="executiveStandard" keyName="executiveStandard" url="/pms/testEnterList/list"
                    name="executiveStandard" boxTitle="执行标准" value="${entryEntity.executiveStandard?default('')}" labelValue="${entryEntity.executiveStandard?default('')}"
                    tableInfo = "[{field:'testName',title:'标准分类'},{field:'executiveStandard',title:'执行标准'},{field:'createTime',title:'登记时间'}]"
                    placeholder="请选择执行标准" />

                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "登记时间"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input type="text" class="time-input" id="birthday" placeholder="登记时间"
                               value="${entryEntity.registrationTime?string('yyyy-MM-dd HH:mm:ss')}" name="registrationTime"
                               data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/>
                        <!--readonly="true"-->
                    </div>
                </div>
            </div>
        </div>



    </div>



</div>




</@f.form>
<div class="hr-line-dashed"></div>
<div class="row" style="text-align: center;" id="_addTab">
    <!--<button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;-->
    <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
    <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.closeTab()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
</div>
</div>
<@footer>
<script type="text/javascript">
    var prefix = baseURL + "pms/entry";

    $('#tipBut button').click(function(){
        $('#comment').text($(this).text())
    });

    $("#task-form-complete").validate({
        focusCleanup: true
    });
    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        console.log(id)
        if(id == "entrustCode"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes.table[0]);
            var data = nodes.table[0];
            $("input[name=sampleCode]").val(data.sampleCode);
            // $("input[name=level]").val(data.specifications2);



        }
    }

    function submitHandler() {

        //  var arrivalAmount= parseFloat($('input[name="arrivalAmount"]').val());
        //  var claimAmount= parseFloat($('input[name="claimAmount"]').val());
        //  console.log(arrivalAmount);
        //  console.log(claimAmount);
        //  console.log(claimAmount>arrivalAmount);
        // if(claimAmount>arrivalAmount){
        //   //  alert("已认领金额不能大于到账金额");
        //   return  opt.modal.alertWarning("已认领金额不能大于到账金额");
        // }

        if (opt.validate.form()) {
            opt.operate.saveTab(prefix + "/edit", $('#task-form-complete').serialize());
        }
    }
</script>
</@footer>
</@pageTheme>